﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved All Rights Reserved All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>

namespace FinPlusAssembler
{
    public static class ObjectExtensions
    {
        public static bool TryCast<T>(this object value, T defaultValue, out T result)
        {
            try
            {
                result = (T)value;
                return true;
            }
            catch
            {
                result = defaultValue;
                return false;
            }
        }
    }
}
